//package cn.yitun.chat.yitunserverrunsingleboot.im.common.interceptor;
//
//import cn.yitun.chat.yituncommonlibutil.lib.util.YitunJsonUtil;
//import cn.yitun.chat.yituncommonmessage.result.ResultMessage;
//import cn.yitun.chat.yitunservermanagecore.util.ResponseUtil;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerExceptionResolver;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * 类描述：异常捕获
// *
// */
//@Component
//@Slf4j
//public class ExceptionResolver implements HandlerExceptionResolver {
//
//
//	@Override
//	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
//		StackTraceElement[] array = ex.getStackTrace();
//		StringBuilder exception = new StringBuilder();
//		if (null != array) {
//			for (StackTraceElement stackTraceElement : array) {
//				exception.append(stackTraceElement);
//				exception.append("\n");
//			}
//		}
//		log.error(ex.getMessage(), ex);
//
//		ResultMessage result = new ResultMessage();
//		result.addError("500", "系统异常！");
//		ResponseUtil.putAllowOrigin(response);
//		ResponseUtil.writer(response, YitunJsonUtil.objectToJson(result));
//		return null;
//	}
//}
